package main.Q1801_1900;

import java.util.TreeSet;

public class Q1841_1850 {
    public static void main(String[] args) {
        System.out.println("Question1841：");
        System.out.println("Question1842：");
        System.out.println("Question1843：");
        System.out.println("Question1844：");
        System.out.println("Question1845：座位预约管理系统");
        System.out.println("Question1846：");
        System.out.println("Question1847：");
        System.out.println("Question1848：");
        System.out.println("Question1849：");
        System.out.println("Question1850：");
    }
}

class Question1845{
    int[] sets;
    TreeSet<Integer> treeSet;
    public Question1845(int n) {
        sets=new int[n+1];
        treeSet=new TreeSet<>();
        for (int i=1;i<=n;i++){
            treeSet.add(i);
        }
    }

    public int reserve() {
        int min=treeSet.pollFirst();
        sets[min]=1;
        return min;
    }

    public void unreserve(int seatNumber) {
        treeSet.add(seatNumber);
        sets[seatNumber]=0;
    }
}